package model

import (
	"gitee.com/zaiqiang231/lovesport-user-service/app/model/meta"
)

type User struct {
	meta.RecordModel
	Enable      int            `json:"enable" gorm:"default:1;comment:用户是否被冻结 1正常 2冻结"`
	Name        string         `json:"name" validate:"required" gorm:"index;unique;not null;comment:用户登录名"`
	Password    string         `json:"-" gorm:"not null;comment:用户登录密码"`
	NickName    string         `json:"nickName" gorm:"default:用户昵称;comment:用户昵称"`
	HeaderImg   string         `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"`
	Email       string         `json:"email" gorm:"comment:用户邮箱"`
	Phone       string         `json:"phone" gorm:"comment:用户手机号"`
	SideMode    string         `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"`
	BaseColor   string         `json:"baseColor" gorm:"default:#fff;comment:基础颜色"`
	ActiveColor string         `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"`
	AuthorityId uint           `json:"authorityId" gorm:"default:888;comment:用户角色ID"`
	Authority   SysAuthority   `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
	Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"`
}

func (User) TableName() string {
	return "user"
}
